package com.jzo2o.orders.manager.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jzo2o.api.market.dto.request.CouponUseBackReqDTO;
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
import com.jzo2o.api.orders.dto.response.OrderResDTO;
import com.jzo2o.api.orders.dto.response.OrderSimpleResDTO;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.common.model.msg.TradeStatusMsg;
import com.jzo2o.orders.base.model.domain.Orders;
import com.jzo2o.orders.manager.model.dto.OrderCancelDTO;
import com.jzo2o.orders.manager.model.dto.request.OrderPageQueryReqDTO;
import com.jzo2o.orders.manager.model.dto.request.OrdersPayReqDTO;
import com.jzo2o.orders.manager.model.dto.request.PlaceOrderReqDTO;
import com.jzo2o.orders.manager.model.dto.response.OperationOrdersDetailResDTO;
import com.jzo2o.orders.manager.model.dto.response.OrdersPayResDTO;
import com.jzo2o.orders.manager.model.dto.response.PlaceOrderResDTO;

import java.util.List;

/**
 * <p>
 * 下单服务类
 * </p>
 *
 * @author itcast
 * @since 2023-07-10
 */
public interface IOrdersCreateService extends IService<Orders> {


    /**
     * 预约下单
     * @param dto
     * @return
     */
    PlaceOrderResDTO placeOrder(PlaceOrderReqDTO dto);

    /**
     * 保存订单信息
     * @param orders
     */
    void add(Orders orders);

    /**
     * 申请支付，返回支付二维码
     * @param orderId
     * @param dto
     * @return
     */
    OrdersPayResDTO pay(Long orderId, OrdersPayReqDTO dto);

    /**
     * 支付成功后更新订单状态
     * @param tradeStatusMsg
     */
    void paySuccess(TradeStatusMsg tradeStatusMsg);

    /**
     * 查询订单的支付状态
     * @param orderId
     * @return
     */
    OrdersPayResDTO payResult(Long orderId);

    /**
     * 获取可用优惠券列表
     * @param serveId 服务id
     * @param purNum 购买数量
     * @return
     */
    List<AvailableCouponsResDTO> getAvailableCoupons(Long serveId, Integer purNum);

    /**
     * 使用优惠券下单时保存订单
     * @param orders 订单信息
     * @param couponId 优惠券id
     */
    void addWithCoupon(Orders orders, Long couponId);
}
